from dao import db
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey
from sqlalchemy.orm import relationship
import datetime

class Room(db.Model):
    id = Column(Integer, primary_key = True)
    #description = Column(String(512))
    type = Column(Integer)
    level = Column(Integer)
    unit = Column(String(32))
    living_space = Column(Integer)
    floor = Column(Integer)
    bath = Column(Integer)
    kitchen = Column(Integer)
    ac = Column(Integer)
    meal = Column(Integer)
    created = Column(DateTime)
    
    #rent_id = Column(Integer, ForeignKey('rent.id'))
    
    address_id = Column(Integer)#, ForeignKey('address.id'))
    #address = relationship('Address', backref='rooms')
        
    def __init__(self, #description, 
                 _type, level, unit, living_space=None, floor=None, bath=None, kitchen=None, ac=None, meal=None):

        #self.description = description
        self.type = _type
        self.level = level
        self.unit = unit
        self.living_space = living_space
        self.floor = floor
        self.bath = bath
        self.kitchen = kitchen
        self.ac = ac
        self.meal = meal
        
        self.created = datetime.datetime.now()


    def __repr__(self):
        return '<Property %r>' % (self.name)

if __name__ == '__main__':
    # create table
    #db.drop_all()
    #db.create_all()
    pass